package com.example.xx.service;


import com.example.xx.dao.ArticleDao;
import com.example.xx.pojo.Article;

import com.example.xx.util.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ArticleServiceImpl implements ArticleService{
    @Autowired
    private ArticleDao articleDao;
    @Override
    public PageInfo<Article> cha(PageUtil xx) {
        PageHelper.startPage(xx.getPageNum(),xx.getPageSize());
        Integer id = (int)xx.getId();
        List<Article> articles =articleDao.cha(id);

        PageInfo<Article> cc=new PageInfo<>(articles);
        return cc;
    }

    @Override
    public int shanchu(Integer id) {
        return articleDao.shanchu(id);
    }

    @Override
    public int tianjia(Article article) {
        return   articleDao.tianjia(article);

    }

    @Override
    public int update(Article article) {
        return articleDao.update(article);
    }
}
